
var userDB = {
    users : new Array(),
    addUser : function(newUser) {
        var exists = false;
        for (var i in this.users) {
            var user = this.users[i];
            if (user.uid == newUser.uid) {
                exists = true;
            }
        }
        if (!exists) {
            this.users.push(newUser);
        }
        return !exists;
    },
    findUser : function(uid) {
        for (var i in this.users) {
            var user = this.users[i];
            if (user.uid == uid) {
                return user;
            }
        }
        return null;
    }
};

module.exports = userDB;
